package com.hot100.mid;

/**
 * @author zhengTao
 * @version 1.0
 * @description: 搜索二维矩阵 II
 * @date 2022/10/2 11:41
 */
public class Demo44 {
    public static void main(String[] args) {

    }

    public boolean searchMatrix(int[][] matrix, int target) {
        if(matrix==null){
            return false;
        }
         int high=matrix.length;
         int with=matrix[0].length;
        for (int i = 0; i < high; i++) {
            if(matrix[i][0]==target){
                return true;
            } else if(matrix[i][0]>target){
                return false;
            }
            for (int j = 1; j <with ; j++) {
                if(matrix[i][j]==target){
                    return true;
                }
            }
        }
        return false;
    }
}
